home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / st80_pr4.lha / st80_pre4 / MoDE / TestMVC-Shan.st < prev    next >
Text File  |  1993-07-24  |  36KB  |  1,331 lines

  1. Object subclass: #PseudoAncestorMode
  2.     instanceVariableNames: 'rootMode '
  3.     classVariableNames: ''
  4.     poolDictionaries: ''
  5.     category: 'TestMVC-Shan'!
  6. PseudoAncestorMode comment:
  7. 'This is used in the ''commonAncestor'' method of RootMode to take care of the problem that a rootMode doesn''t have a parent.  The pseudo mode is used in generating and processing the enter/leave mode events.'!
  8.  
  9.  
  10. !PseudoAncestorMode methodsFor: 'private'!
  11.  
  12. rootMode: aRootMode
  13.     rootMode _ aRootMode! !
  14.  
  15. !PseudoAncestorMode methodsFor: 'enter/leaveEvent-process'!
  16.  
  17. topSubModeEnteredFrom: offspring 
  18.     ^rootMode!
  19.  
  20. topSubModeLeft
  21.     ^nil! !
  22. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  23.  
  24. PseudoAncestorMode class
  25.     instanceVariableNames: ''!
  26.  
  27.  
  28. !PseudoAncestorMode class methodsFor: 'instance creation'!
  29.  
  30. newWith: aRootMode
  31.     ^super new rootMode: aRootMode! !
  32.  
  33. ExpandedMode subclass: #RootMode
  34.     instanceVariableNames: 'label minium minimumSize maximumSize eventQueue terminateBlock '
  35.     classVariableNames: ''
  36.     poolDictionaries: ''
  37.     category: 'TestMVC-Shan'!
  38. RootMode comment:
  39. 'I am the real root of the MMS mode hierarchy.  My super class is a View1 which is very different than an ordinary View.'!
  40.  
  41.  
  42. !RootMode methodsFor: 'initialize-release'!
  43.  
  44. initialize
  45.     super initialize.
  46.     self insideColor: Form white.! !
  47.  
  48. !RootMode methodsFor: 'layering'!
  49.  
  50. computeLayering
  51.     "The superView of me is a StandardSystemView which doesn't know the layering relation.  Don't ask it for the obscuringRects."
  52.     " Shan April 8, 1989"
  53.  
  54.     self computeSubLayering! !
  55.  
  56. !RootMode methodsFor: 'tracking/replay'!
  57.  
  58. eventQueue
  59.     "For tracking and replay. Shan 13 July 1990"
  60.  
  61.     eventQueue isNil
  62.         ifTrue: [^EventQ]
  63.         ifFalse: [^eventQueue]!
  64.  
  65. eventQueue: aQ 
  66.     "For tracking and replay. Shan 13 July 1990"
  67.  
  68.     eventQueue _ aQ! !
  69.  
  70. !RootMode methodsFor: 'startUp/stopRunning'!
  71.  
  72. startUp
  73.     "This is the place to crank up the MMS."
  74.     "Use 'self close. self controlTreminate' in debugger with   
  75.     MMSStdSysController selected to terminate the stray process."
  76.     "Initialize the private response dict of each controller class.  Shan   
  77.     May 24, 1989"
  78.  
  79.     MController initAllERDict.
  80.     MMSStdSysView startUp: self!
  81.  
  82. stopRunning
  83.     superView controller close.
  84.     "self eventQueue flush  Shan 19 July 1990"
  85.     "running _ false."! !
  86.  
  87. !RootMode methodsFor: 'enter/leaveEvent-process'!
  88.  
  89. commonAncestor
  90.     "RootMode is a special case.  It does not have a superMode (the  
  91.     environment polling view doesn't count).  A pseudo superMode is  
  92.     returned to keep the algorithm from handling the special case."
  93.     "Shan Mrach 15, 1989"
  94.  
  95.     cursorIn
  96.         ifTrue: [^self]
  97.         ifFalse: ["We come to here only when the previous cursor point is  
  98.             outside the rootMode and the current point is inside.  That is 
  99.             the cursor moves from out of rootMode into it."
  100.             ^PseudoAncestorMode newWith: self]! !
  101.  
  102. !RootMode methodsFor: 'superMode access'!
  103.  
  104. isTopMode
  105.     "Shan Mrach 17, 1989"
  106.  
  107.     ^ true!
  108.  
  109. topMode
  110.     "Shan Mrach 17, 1989"
  111.  
  112.     ^self! !
  113.  
  114. !RootMode methodsFor: 'displaying'!
  115.  
  116. display
  117.     "The logic that cuts down the recursion when self is not visible is       
  118.      added."
  119.     " Shan March 19, 1989"
  120.  
  121.     self map.
  122.     self displayIn: nil! !
  123.  
  124. !RootMode methodsFor: 'label access'!
  125.  
  126. label
  127.     "Shan April 26, 1989"
  128.  
  129.     ^ label!
  130.  
  131. label: aString
  132.     "Shan April 26, 1989"
  133.  
  134.     ^ label _ aString! !
  135.  
  136. !RootMode methodsFor: 'sizing'!
  137.  
  138. edit
  139.     "There will be a circular structure here.  See the code in Mode>edit.  
  140.     RootMode must be visible.  Otherwise no event will be processed.  
  141.     Shan September 16, 1989"
  142.  
  143.     super edit.
  144.     visible _ true!
  145.  
  146. maximumSize
  147.     "Answer a point representing the maximum width and height of the 
  148.     receiver. Shan April 26, 1989"
  149.  
  150.     ^maximumSize!
  151.  
  152. maximumSize: aPoint 
  153.     "Set the argument, aPoint, to be the maximum width and height of the receiver."
  154.     maximumSize _ aPoint!
  155.  
  156. minimumSize
  157.     "Answer a point representing the minimum width and height of the receiver."
  158.     ^minimumSize!
  159.  
  160. minimumSize: aPoint 
  161.     "Set the argument, aPoint, to be the minimum width and height of the receiver."
  162.     minimumSize _ aPoint! !
  163.  
  164. !RootMode methodsFor: 'private'!
  165.  
  166. setVisible: aBool 
  167.     "This is override to handle the Smallatlk window mengement stuff.  The MMSStdSysController use this message to disable the process of events in RootMode.  Shan April 26, 1989"
  168.  
  169.     visible ~= aBool
  170.         ifTrue: 
  171.             [visible _ aBool.
  172.             "superView computeSubLayeringBelow: self withIn: self displayBox"]! !
  173.  
  174. !RootMode methodsFor: 'displaying-private'!
  175.  
  176. displayModesInFrontOf: aMode on: aMedium in: aRect 
  177.     "This is for painter modes and modes that has other modes with   
  178.     insideColor nil on top of them.  This should cut the search in half and 
  179.     therefore give %50 better preformance.  Shan July 17, 1989"
  180.  
  181.     | found |
  182.     found _ false.
  183.     subViews do: 
  184.         [:aSubView | 
  185.         found ifTrue: [aSubView displayOn: aMedium in: aRect].
  186.         aSubView == aMode ifTrue: [found _ true]]! !
  187.  
  188. !RootMode methodsFor: 'layer manipulation'!
  189.  
  190. map
  191.     "Make a mode active. Shan 14 June 1990"
  192.  
  193.     self setVisible: true! !
  194.  
  195. !RootMode methodsFor: 'basic control sequence'!
  196.  
  197. terminateBlock
  198.     "Shan 19 July 1990"
  199.  
  200.     ^ terminateBlock!
  201.  
  202. terminateBlock: aB
  203.     "Shan 19 July 1990"
  204.  
  205.     terminateBlock _ aB! !
  206.  
  207. Model subclass: #SemanticObject
  208.     instanceVariableNames: 'mode delegate target1 '
  209.     classVariableNames: ''
  210.     poolDictionaries: ''
  211.     category: 'TestMVC-Shan'!
  212.  
  213.  
  214. !SemanticObject methodsFor: 'access'!
  215.  
  216. mode 
  217.     ^mode!
  218.  
  219. mode: aMode
  220.     mode _ aMode!
  221.  
  222. target1
  223.     "Shan August 9, 1989"
  224.  
  225.     ^target1!
  226.  
  227. target1: t
  228.     "Shan August 9, 1989"
  229.  
  230.     target1 _ t! !
  231.  
  232. !SemanticObject methodsFor: 'initialize-release'!
  233.  
  234. initialize
  235.     self setUpMode.
  236.     self setUpAppearance.
  237.     self setUpController.!
  238.  
  239. release
  240.     "Shan August 23, 1989"
  241.     "mode _ nil.
  242.     delegate _ nil.
  243.     target1 _ nil."
  244.     super release.
  245.     self nilFields! !
  246.  
  247. !SemanticObject methodsFor: 'mode attaching'!
  248.  
  249. attachModeTo: aMode
  250.     "This place the window on to the root mode.  Shan August 4, 1989"
  251.  
  252.     self attachModeTo: aMode at: mode origin!
  253.  
  254. attachModeTo: aMode absAt: p 
  255.     "This place the window on to the root mode.  Shan August 4, 1989"
  256.  
  257.     self attachModeTo: aMode absAt: p extent: mode extent!
  258.  
  259. attachModeTo: aMode absAt: p extent: e
  260.     "This place the window on to the parent mode.  Shan July 16, 1989"
  261.  
  262.     aMode addSubMode: self mode absAt: p extent: e!
  263.  
  264. attachModeTo: aMode at: p 
  265.     "This place the window on to the root mode.  Shan August 4, 1989"
  266.  
  267.     self attachModeTo: aMode at: p extent: mode extent!
  268.  
  269. attachModeTo: aMode at: p extent: e
  270.     "This place the window on to the parent mode.  Shan July 16, 1989"
  271.  
  272.     aMode addSubMode: self mode at: p extent: e! !
  273.  
  274. !SemanticObject methodsFor: 'drag support'!
  275.  
  276. dragControllerFor: aSymbol
  277.     "The default drag controller.  Shan July 13, 1989"
  278.  
  279.     ^OpaqueController1 new! !
  280.  
  281. !SemanticObject methodsFor: 'MMS-initializations'!
  282.  
  283. defaultMMSControllerClass
  284.     "Used in setUpController.  Shan July 21, 1989"
  285.     
  286.     ^OpaqueController1!
  287.  
  288. defaultModeClass
  289.     "Used in setUpMode.  Shan July 21, 1989"
  290.     
  291.     ^Mode!
  292.  
  293. setUpAppearance
  294.     "Shan June 6, 1989"!
  295.  
  296. setUpController
  297.     "Shan July 21, 1989"
  298.  
  299.     mode controller: self defaultMMSControllerClass new!
  300.  
  301. setUpMode
  302.     "A semantic object can not do without a mode. Shan June 20, 1989"
  303.  
  304.     mode _ self defaultModeClass new.
  305.     mode semanticObject: self! !
  306.  
  307. !SemanticObject methodsFor: 'copying'!
  308.  
  309. deepCopy
  310.     "To prevent copying the delegate, which will loop back to rootMode    
  311.        and copy a lot of unnecessary objects.   Shan  August 16, 1989"
  312.  
  313.     | delTemp targTemp targCopy c |
  314.     delTemp _ delegate.
  315.     targTemp _ target1.
  316.     delegate _ nil.
  317.     "IdDictonary does not accept nil as a key, but doesn't bumb.  Just 
  318.     has no effect."
  319.     (OccurrenceDictionary includesKey: target1)
  320.         ifTrue: ["Temp fix. Bad.  Need a general solution.  Avoid copying   
  321.             the target1 more than once.  Shan September 2, 1989"
  322.             target1 _ nil]
  323.         ifFalse: ["First time. Register the copy"
  324.             OccurrenceDictionary at: target1 put: target1 deepCopy].
  325.     c _ self privateDeepCopy.
  326.     delegate _ delTemp.
  327.     target1 _ targTemp.
  328.     "Wire the pointer."
  329.     targCopy _ OccurrenceDictionary at: target1 ifAbsent: [].
  330.     c target1: targCopy.
  331.     ^c!
  332.  
  333. duplicate
  334.     "Shan August 26, 1989"
  335.  
  336.     ^ mode duplicate semanticObject!
  337.  
  338. privateDeepCopy
  339.     "Check self against the OccurrenceDictionary.  This method is 
  340.     overriden in the Mode, MMSController1, SemanticObject and DispObj 
  341.     class.  Shan  August 3, 1989"
  342.  
  343.     | newObject class index exist |
  344.     exist _ true.
  345.     newObject _ OccurrenceDictionary at: self ifAbsent: [exist _ false].
  346.     exist ifFalse: 
  347.             [class _ self class.
  348.             class == Object ifTrue: [^self].
  349.             class isVariable
  350.                 ifTrue: 
  351.                     [index _ self basicSize.
  352.                     newObject _ class basicNew: index.
  353.                     OccurrenceDictionary at: self put: newObject.
  354.                     [index > 0]
  355.                         whileTrue: 
  356.                             [newObject basicAt: index put: (self basicAt: index) deepCopy.
  357.                             index _ index - 1]]
  358.                 ifFalse: 
  359.                     [newObject _ class basicNew.
  360.                     OccurrenceDictionary at: self put: newObject].
  361.             index _ class instSize.
  362.             [index > 0]
  363.                 whileTrue: 
  364.                     [newObject instVarAt: index put: (self instVarAt: index) deepCopy.
  365.                     index _ index - 1]].
  366.     ^newObject! !
  367.  
  368. !SemanticObject methodsFor: 'connection model support'!
  369.  
  370. clearAllConnections
  371.     "This is issued when a mode is about to be removed.  Shan August 12, 
  372.     1989 "
  373.  
  374.     delegate isNil ifFalse: [delegate clearConnectionsAndRemove]!
  375.  
  376. clientObject
  377.     "This is here to fake the SemObj as a Delegate.  Shan August 14, 1989"
  378.  
  379.     ^self!
  380.  
  381. delegate
  382.     "This is used by the ModeEditProxy.  Shan August 6, 1989"
  383.  
  384.     delegate isNil ifTrue: [delegate _ SemObjDelegate clientObject: self].
  385.     ^delegate!
  386.  
  387. removeLink: l 
  388.     "There should be a better way to do this.  This message is here to 
  389.     support to 'clearConnectionsAndRemove' method in ObjectDelegate.  
  390.     Shan August 12, 1989"
  391.  
  392.     ^self! !
  393.  
  394. !SemanticObject methodsFor: 'attribute editor'!
  395.  
  396. editAttributes
  397.     "The form edit stuff should not be here. Shan August 25, 1989"
  398.  
  399.     | f |
  400.     (mode isKindOf: FixedImageMode)
  401.         ifTrue: 
  402.             [f _ mode displayObject contents first deepCopy.
  403.             mode displayObject clear; absAdd: f.  "Shan 29 May 1990"
  404.             f extent * 8 < Display boundingBox extent
  405.                 ifTrue: 
  406.                     [self eventQueue disable.    "Shan September 16, 1989"
  407.                     f bitEdit]
  408.                 ifFalse: 
  409.                     ["Use form editor"
  410.                     self eventQueue disable.
  411.                     [f figure edit] fork.    "Shan September 30, 1989"
  412.                     f shape edit]]
  413.         ifFalse: [^self notify: 'No special editor provided yet.']! !
  414.  
  415. !SemanticObject methodsFor: 'tracking/replay'!
  416.  
  417. eventQueue
  418.     "Shan 13 July 1990"
  419.  
  420.     ^mode eventQueue! !
  421. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  422.  
  423. SemanticObject class
  424.     instanceVariableNames: ''!
  425.  
  426.  
  427. !SemanticObject class methodsFor: 'instance creation'!
  428.  
  429. new
  430.     ^super new initialize! !
  431.  
  432. Object subclass: #MController
  433.     instanceVariableNames: 'semObj mode event eventResponses '
  434.     classVariableNames: 'MMSController1ERD '
  435.     poolDictionaries: ''
  436.     category: 'TestMVC-Shan'!
  437. MController comment:
  438. 'In the eventResponses dictionary there are 3 kinds of values:
  439.  
  440. #self    is for system private use.  It means the message selector is implemented in this class.  This is for some of the special class.
  441.  
  442. #Xxx    Symbols that start with a capital letter denote library behaviors provided by the system.
  443.  
  444. #xxx    Symbols that start with small case letter denote messages for the model.  The model will be sent a message with the selector #xxx with the event as an argument.
  445.  
  446. Shan May 24, 1989
  447.  
  448. The intance variable ''eventResponses'' is put in to reserve the ability of changing both a single instance (eg. a customized button) and all instances (eg. all network nodes) of a class.  Shan May 25, 1989'!
  449.  
  450.  
  451. !MController methodsFor: 'private'!
  452.  
  453. mode: aMode 
  454.     "Shan June 11, 1989"
  455.  
  456.     (mode notNil and: [aMode ~~ mode and: [mode controller == self]])
  457.         ifTrue: [mode controller: nil].
  458.     mode _ aMode. 
  459.     mode controller ~= self ifTrue: [mode controller: self]! !
  460.  
  461. !MController methodsFor: 'access'!
  462.  
  463. event
  464.     "This is for the semObj that invokes a popUp menu to find out where 
  465.     the user pressed the mouse button. Useful for when new object is 
  466.     created in a mode. Shan October 21, 1989"
  467.  
  468.     ^event!
  469.  
  470. eventResponses
  471.     ^eventResponses!
  472.  
  473. eventResponses: newER
  474.     eventResponses _ newER!
  475.  
  476. semanticObject
  477.     "Shan June 11, 1989"
  478.  
  479.     ^semObj!
  480.  
  481. semanticObject: aSemObj 
  482.     "Shan June 11, 1989"
  483.  
  484.  
  485.     semObj _ aSemObj! !
  486.  
  487. !MController methodsFor: 'initialize-release'!
  488.  
  489. initialize
  490.     eventResponses _ self class eventResponsesDict!
  491.  
  492. release
  493.     "Shan August 23, 1989"
  494.  
  495.     super release.
  496.     self nilFields! !
  497.  
  498. !MController methodsFor: 'event handling'!
  499.  
  500. checkSpecialEvent
  501.     "This is to handle the MMS interrupt.  Shan June 13, 1989"
  502.  
  503.     (event selector == #keyboardEvent and: [event keyboardEvent hasCtrl and: [event keyboardEvent keyValue = 5 and: [self shouldProcessInterrupt]]])
  504.         ifTrue: 
  505.             [self processInterrupt.
  506.             "This does not return.  In the future, we may use a different 
  507.             inspector which will return.  It is helpful to keep the logic 
  508.             straight.  Shan Juen 13, 1989"
  509.             ^true]
  510.         ifFalse: [^false]!
  511.  
  512. defaultReturnValue
  513.     "This value distinguishes MMSController1 from OpaqueController1.  
  514.     Shan June 13, 1989"
  515.  
  516.     ^false!
  517.  
  518. processEvent: anEvent 
  519.     "eventResponses is a dictionary that stores pairs of event and          
  520.        response.  This provides dynamic binding ability to support the       
  521.       
  522.        
  523.      flexibility needed by the MMS.  Shan May 24, 1989"
  524.  
  525.     | responseSymbol returnValue |
  526.     event _ anEvent.
  527.     "self showEvent: event."
  528.     "Check for MMS edit UI special key.  Shan June 9, 1989"
  529.     self checkSpecialEvent ifTrue: [^true].
  530.     responseSymbol _ eventResponses at: anEvent selector ifAbsent: [^self defaultReturnValue].
  531.     responseSymbol == #self
  532.         ifTrue: ["Simulate ICPak 201.  See eg. use in PollingEnvController1."
  533.             ^self perform: anEvent selector]
  534.         ifFalse: [responseSymbol last == $:
  535.                 ifTrue: 
  536.                     ["user defined msg.  send it to the semObj"
  537.                     returnValue _ semObj perform: responseSymbol with: event.
  538.                     "Assume the event does not want to be processed   
  539.                     again unless the semObj explicitly returns a false   
  540.                     which indicates the event should be pass on to the   
  541.                     next mode"
  542.                     returnValue = false
  543.                         ifTrue: [^false]
  544.                         ifFalse: [^true]]
  545.                 ifFalse: ["shared msg"
  546.                     ^self perform: responseSymbol]]!
  547.  
  548. showEvent: e 
  549.     | l m r |
  550. Transcript cr; show: e selector printString.
  551.     "e rightButtonDown
  552.         ifTrue: [r _ '1']
  553.         ifFalse: [r _ '0'].
  554.     e leftButtonDown
  555.         ifTrue: [l _ '1']
  556.         ifFalse: [l _ '0'].
  557.     e middleButtonDown
  558.         ifTrue: [m _ '1']
  559.         ifFalse: [m _ '0'].
  560.     Transcript cr; show: l , m , r"! !
  561.  
  562. !MController methodsFor: 'sharedBehavior-resize'!
  563.  
  564. bottomCenterMoved
  565.     "Shan June 13, 1989"
  566.  
  567.     self resize: #bottomCenter outline: [:frame :mousePoint | frame bottom: mousePoint y]!
  568.  
  569. bottomLeftMoved
  570.     "Shan June 14, 1989"
  571.  
  572.     self resize: #bottomLeft
  573.         outline: 
  574.             [:frame :mousePoint | 
  575.             frame bottom: mousePoint y.
  576.             frame left: mousePoint x]!
  577.  
  578. bottomRightMoved
  579.     "Shan June 13, 1989"
  580.  
  581.     self resize: #bottomRight outline: [:frame :mousePoint | frame corner: mousePoint]!
  582.  
  583. leftCenterMoved
  584.     "Shan June 13, 1989"
  585.  
  586.     self resize: #leftCenter outline: [:frame :mousePoint | frame left: mousePoint x]!
  587.  
  588. resize: aSymbol outline: aBlock 
  589.     "New bug in ver2.5. If the width is 1, there will be some garbage 
  590.     draw on the screen. Shan September 30, 1989"
  591.  
  592.     self
  593.         resize: aSymbol
  594.         outline: aBlock
  595.         width: 2
  596.         halftone: Form gray!
  597.  
  598. resize: aSymbol outline: aBlock width: aWidth halftone: aMask 
  599.     "Shan June 13, 1989"
  600.  
  601.     | frame eq |
  602.     frame _ mode unclippedDisplayBox.
  603.     Sensor cursorPoint: (frame perform: aSymbol).
  604.     eq _ self eventQueue. "Shan 13 July 1990"
  605.     Display
  606.         outline: 
  607.             [event _ eq nextWithCursorMoveCompressed.
  608.             aBlock value: frame value: event origin - Cursor currentCursor offset]
  609.         while: ["Shan October 31, 1989"
  610.             event selector ~= #leftButtonUp & (event selector ~= #middleButtonUp) & (event selector ~= #rightButtonUp)]
  611.         width: aWidth
  612.         halftone: aMask.
  613.     Cursor wait
  614.         showWhile: 
  615.             [mode changed: #beforeErase.    "Give the resizeDots a chance to erase themselves. Shan 
  616.             June 14, 1989"
  617.             mode erase.
  618.             mode setUnclippedDisplayBox: frame.
  619.             mode display]!
  620.  
  621. rightCenterMoved
  622.     "Shan June 13, 1989"
  623.  
  624.     self resize: #rightCenter outline: [:frame :mousePoint | frame right: mousePoint x]!
  625.  
  626. topCenterMoved
  627.     "Shan June 13, 1989"
  628.  
  629.     self resize: #topCenter outline: [:frame :mousePoint | frame top: mousePoint y]!
  630.  
  631. topLeftMoved
  632.     "Shan June 13, 1989"
  633.  
  634.     self resize: #topLeft outline: [:frame :mousePoint | frame topLeft: mousePoint]!
  635.  
  636. topRightMoved
  637.     "Shan June 14, 1989"
  638.  
  639.     self resize: #topRight
  640.         outline: 
  641.             [:frame :mousePoint | 
  642.             frame top: mousePoint y.
  643.             frame right: mousePoint x]! !
  644.  
  645. !MController methodsFor: 'sharedBehavior-move'!
  646.  
  647. moveClippedImage
  648.     "The image moved is the same as the moveImage except it is clipped    
  649.      to the superMode.  Shan May 25, 1989"
  650.     "Used by the event processing mechanism.  Must return a Boolean.    
  651.     Shan August 1, 1989"
  652.  
  653.     | dispBox offset bk pt eq |
  654.     self
  655.         privateMoveStyle: 
  656.             [:startPt | 
  657.             mode changed: #beforeErase.
  658.             "Give the resizeDots a chance to erase themselves.  Shan       
  659.             June 14, 1989"
  660.             mode erase.
  661.             dispBox _ mode unclippedDisplayBox.
  662.             offset _ startPt - dispBox origin.
  663.             bk _ Form extent: 0 @ 0.
  664.             eq _ self eventQueue. "Shan 13 July 1990"
  665.             [event selector ~= #leftButtonUp & (event selector ~= #middleButtonUp) & (event selector ~= #rightButtonUp)]
  666.                 whileTrue: 
  667.                     [event _  eq nextWithCursorMoveCompressed.
  668.                     pt _ event origin - offset.
  669.                     mode moveTo: pt.
  670.                     bk display.
  671.                     bk _ (Form fromDisplay: (pt extent: dispBox extent))
  672.                                 offset: pt.
  673.                     mode display]].
  674.     ^true!
  675.  
  676. moveFrame
  677.     "Trace the mouse and move the mode.  Shan June 20, 1989"
  678.  
  679.     ^self moveFrameWithin: nil!
  680.  
  681. moveFrameConstrained
  682.     "Assume the constraint box is the displayBox of the superMode.  Shan 
  683.     June 20, 1989"
  684.  
  685.     ^self moveFrameWithin: mode superMode insetDisplayBox!
  686.  
  687. moveFrameGridTo: gridPoint
  688.     "Shan March 19, 1990"
  689.  
  690.     ^self moveFrameWithin: nil linkTo: OrderedCollection new gridPoint: gridPoint!
  691.  
  692. moveFrameWithin: aRect 
  693.     "Shan July 24, 1989"
  694.  
  695.     ^self moveFrameWithin: aRect linkTo: OrderedCollection new!
  696.  
  697. moveFrameWithin: aRect linkTo: points 
  698.     "Shan August 1, 1989"
  699.  
  700.     | pos |
  701.     pos _ self moveFrameFBWithin: aRect linkTo: points.
  702.     pos notNil
  703.         ifTrue: 
  704.             [mode erase.
  705.             mode setUnclippedDisplayBoxOrigin: pos.
  706.             mode display].
  707.     "The event has been consumed.  Sould return true."
  708.     ^true!
  709.  
  710. moveFrameWithin: aRect linkTo: points gridPoint: gridPoint
  711.     "Shan August 1, 1989"
  712.     "Grid stuffs.  Shan March 19, 1990"
  713.  
  714.     | pos |
  715.     pos _ self moveFrameFBWithin: aRect linkTo: points gridPoint: gridPoint.
  716.     pos notNil
  717.         ifTrue: 
  718.             [mode erase.
  719.             mode setUnclippedDisplayBoxOrigin: pos.
  720.             mode display].
  721.     "The event has been consumed.  Sould return true."
  722.     ^true!
  723.  
  724. moveImage
  725.     "Trace the mouse and move the mode using a form that shows the     
  726.     image of the mode as opposed in moveFrame which uses a rubber     
  727.     band box to show the position of the mode.  Shan July 12, 1989"
  728.  
  729.     ^self moveImageWithin: nil!
  730.  
  731. moveImageConstrained
  732.     "Shan June 20, 1989"
  733.  
  734.     ^self moveImageWithin: mode superMode insetDisplayBox!
  735.  
  736. moveImageGridTo: gridPoint
  737.     "Shan March 19, 1990"
  738.  
  739.     ^self moveImageWithin: nil linkTo: OrderedCollection new gridPoint: gridPoint!
  740.  
  741. moveImageWithin: aRect 
  742.     "Shan June 24, 1989"
  743.  
  744.     ^self moveImageWithin: aRect linkTo: OrderedCollection new!
  745.  
  746. moveImageWithin: aRect linkTo: points 
  747.     "Shan March 19, 1990"
  748.  
  749.     ^self
  750.         moveImageWithin: aRect
  751.         linkTo: points
  752.         gridPoint: 1 @ 1!
  753.  
  754. moveImageWithin: aRect linkTo: points gridPoint: gridPoint
  755.     "This is used by the event processing mechanism.  Must return a 
  756.     Boolean.  Shan August 1, 1989"
  757.     "Add the grid stuffs.  Shan March 19, 1990"
  758.  
  759.     | pos |
  760.     pos _ self moveImageFBWithin: aRect linkTo: points gridPoint: gridPoint.
  761.     pos notNil
  762.         ifTrue: 
  763.             [mode setUnclippedDisplayBoxOrigin: pos.
  764.             mode display].
  765.     "The event has been consumed.  Sould return true."
  766.     ^true! !
  767.  
  768. !MController methodsFor: 'sharedBehavior-mv support'!
  769.  
  770. check: containedBox against: containingBox 
  771.     "Make sure the containment relationship between the two boxes.  
  772.     Shan June 20, 1989"
  773.  
  774.     | trans |
  775.     (trans _ containedBox amountToTranslateWithin: containingBox) = (0 @ 0)
  776.         ifTrue: [^containedBox]
  777.         ifFalse: [^containedBox translateBy: trans]!
  778.  
  779. moveFrameFB
  780.     "Shan August 1, 1989"
  781.  
  782.     ^self moveFrameFBWithin: nil!
  783.  
  784. moveFrameFBWithin: aRect
  785.     "Shan August 1, 1989"
  786.  
  787.     ^self moveFrameFBWithin: aRect linkTo: OrderedCollection new!
  788.  
  789. moveFrameFBWithin: aRect linkTo: points 
  790.     "Shan March 19, 1990"
  791.  
  792.     ^self
  793.         moveFrameFBWithin: aRect
  794.         linkTo: points
  795.         gridPoint: 1@1!
  796.  
  797. moveFrameFBWithin: aRect linkTo: points gridPoint: gridPoint
  798.     "Trace the mouse and move the mode.  Keep the feedback confined    
  799.     within aRect.  Shan June 20, 1989"
  800.     "Add the drag feedbacks.  Shan July 24, 1989"
  801.     "Abstracted from the original 'moveFrameWithin:linkTo:'.  Return nil if the 
  802.     mode is not moved.  Shan August 1, 1989"
  803.  
  804.     | tempBox dispBox offset topMode msg centerOffset prePos eq |
  805.     ^self
  806.         privateMoveStyle: 
  807.             [:startPt ":releaseSelector" | 
  808.             topMode _ mode topMode.
  809.             mode beforeDrag: #move.
  810.             dispBox _ mode unclippedDisplayBox.
  811.             offset _ startPt - dispBox origin.
  812.             centerOffset _ (dispBox extent / 2) rounded.
  813.             prePos _ dispBox center.
  814.             ToolGhost
  815.                 starFrom: prePos
  816.                 to: points
  817.                 clip: aRect.
  818.             eq _ self eventQueue.  "Shan 13 July 1990"
  819.             Display
  820.                 outline: 
  821.                     [event _ eq nextWithCursorMoveCompressed.
  822.                     tempBox _ dispBox copy moveTo: event origin - offset.
  823.                     aRect isNil
  824.                         ifTrue: [dispBox _ tempBox]
  825.                         ifFalse: [dispBox _ self check: tempBox against: aRect].
  826.                     "Grided move.  Shan March 19, 1990"
  827.                     dispBox origin: (dispBox origin grid: gridPoint) extent: dispBox extent.
  828.                     dispBox]
  829.                 do: 
  830.                     [ToolGhost
  831.                         starFrom: prePos
  832.                         to: points
  833.                         clip: aRect.
  834.                     event data: (DragData mode: mode offset: offset).
  835.                     event origin: dispBox origin + offset.
  836.                     topMode processEvent: event.
  837.                     "Process the drag highlight.  Shan July 23, 1989"
  838.                     msg _ event data message.
  839.                     msg = #dragHighlight | msg = #dragHighlightOnTop ifTrue: [event data mode highlight].
  840.                     msg = #dragDeHighlight | msg = #dragDeHighlightOnTop ifTrue: [event data mode deHighlight].
  841.                     prePos _ dispBox origin + centerOffset.
  842.                     ToolGhost
  843.                         starFrom: prePos
  844.                         to: points
  845.                         clip: aRect]
  846.                 while: [event selector ~= #leftButtonUp & (event selector ~= #middleButtonUp) & (event selector ~= #rightButtonUp)]
  847.                 width: 2
  848.                 halftone: Form gray.
  849.             ToolGhost
  850.                 starFrom: prePos
  851.                 to: points
  852.                 clip: aRect.
  853.             mode afterDrag: #move.
  854.             mode changed: #beforeErase.
  855.             "Give the resizeDots a chance to erase themselves.  Shan      
  856.             June 14, 1989"
  857.             dispBox origin]!
  858.  
  859. moveImageFB
  860.     "Shan August 1, 1989"
  861.  
  862.     ^self moveImageFBWithin: nil!
  863.  
  864. moveImageFBWithin: aRect
  865.     "Shan August 1, 1989"
  866.  
  867.     ^self moveImageFBWithin: aRect linkTo: OrderedCollection new!
  868.  
  869. moveImageFBWithin: aRect linkTo: points 
  870.     "Shan March 19, 1990"
  871.  
  872.     ^self
  873.         moveImageFBWithin: aRect
  874.         linkTo: points
  875.         gridPoint: 1@1!
  876.  
  877. moveImageFBWithin: aRect linkTo: points gridPoint: gridPoint
  878.     "The code here is so complicated because for smooth (flickering free) 
  879.     move, there is no guarantee that we will have a short break 
  880.     between each move step that the screen is back to the original 
  881.     state (so that we can put other feedback on to it without 
  882.     interfering with the move display update.  Shan June 23, 1989"
  883.     "FB stands for feedback.  Return nil if the mode is not moved. 
  884.     Shan August 1, 1989"
  885.  
  886.     | dispBox centerOffset offset prePos pos topMode background form locationBlock topF topFOrg dragData eq |
  887.     ^self
  888.         privateMoveStyle: 
  889.             [:startPt ":releaseSelector" | 
  890.             dispBox _ mode unclippedDisplayBox.
  891.             offset _ startPt - dispBox origin.
  892.             mode changed: #beforeErase.
  893.             "Give the resizeDots a chance to erase themselves.  Shan       
  894.              June 14, 1989"
  895.             mode erase.
  896.             centerOffset _ (dispBox extent / 2) rounded.
  897.             topMode _ mode topMode.
  898.             mode beforeDrag: #move.
  899.             form _ mode image.
  900.             eq _ self eventQueue. "Shan 13 July 1990"
  901.             locationBlock _ 
  902.                     [event _ eq nextWithCursorMoveCompressed.
  903.                     pos _ event origin - offset.
  904.                     aRect isNil ifFalse: [pos _ (self check: (dispBox moveTo: pos)
  905.                                     against: aRect) origin].
  906.                     "Grided move.  Shan March 19, 1990"
  907.                     pos grid: gridPoint].
  908.             pos _ locationBlock value.
  909.             background _ form backgroundAt: pos.
  910.             form displayAt: pos.
  911.             prePos _ pos.
  912.             ToolGhost
  913.                 starFrom: pos + centerOffset
  914.                 to: points
  915.                 clip: aRect.
  916.             topF _ nil.
  917.             [event selector ~= #leftButtonUp & (event selector ~= #middleButtonUp) & (event selector ~= #rightButtonUp)]
  918.                 whileTrue: 
  919.                     [pos _ locationBlock value.
  920.                     ToolGhost
  921.                         starFrom: prePos + centerOffset
  922.                         to: points
  923.                         clip: aRect.
  924.                     "Store the mode into the data for semantic feedback.  
  925.                         Shan July16, 1989"
  926.                     event data: (DragData mode: mode offset: offset).
  927.                     event origin: pos + offset.
  928.                     topMode processEvent: event.
  929.                     dragData _ event data.
  930.                     dragData message = #dragHighlight
  931.                         ifTrue: 
  932.                             [background display.
  933.                             dragData mode highlight.
  934.                             background _ form backgroundAt: background offset].
  935.                     dragData message = #dragDeHighlight
  936.                         ifTrue: 
  937.                             [background display.
  938.                             dragData mode deHighlight.
  939.                             background _ form backgroundAt: background offset].
  940.                     dragData message = #dragHighlightOnTop
  941.                         ifTrue: 
  942.                             [background display.
  943.                             dragData mode erase.
  944.                             background _ form backgroundAt: background offset.
  945.                             dragData mode highlight.
  946.                             topF _ dragData mode image.
  947.                             topFOrg _ dragData mode displayBox origin].
  948.                     dragData message = #dragDeHighlightOnTop
  949.                         ifTrue: 
  950.                             [background display.
  951.                             dragData mode deHighlight.
  952.                             background _ form backgroundAt: background offset.
  953.                             topF _ nil].
  954.                     self
  955.                         privateMove: form
  956.                         to: pos
  957.                         restoring: background
  958.                         below: topF
  959.                         withOrigin: topFOrg.
  960.                     ToolGhost
  961.                         starFrom: pos + centerOffset
  962.                         to: points
  963.                         clip: aRect.
  964.                     prePos _ pos].
  965.             ToolGhost
  966.                 starFrom: pos + centerOffset
  967.                 to: points
  968.                 clip: aRect.
  969.             background display.
  970.             mode afterDrag: #move.
  971.             pos]!
  972.  
  973. privateMove: aForm to: newLoc restoring: background below: topF withOrigin: topFOrg 
  974.     | location saveAll rect1 rect2 bothRects |
  975.     (location _ background offset) = newLoc ifTrue: [^background].
  976.     background offset: 0 @ 0.
  977.     rect1 _ location extent: aForm extent.
  978.     rect2 _ newLoc extent: aForm extent.
  979.     bothRects _ rect1 merge: rect2.
  980.     (rect1 intersects: rect2)
  981.         ifTrue: 
  982.             ["When overlap, buffer background for both rectangles"
  983.             saveAll _ Form fromDisplay: bothRects.
  984.             background displayOn: saveAll at: rect1 origin - bothRects origin.
  985.             "now saveAll is clean background; get new bits for background"
  986.             background
  987.                 copy: (0 @ 0 extent: aForm extent)
  988.                 from: rect2 origin - bothRects origin
  989.                 in: saveAll
  990.                 rule: Form over.
  991.             aForm displayOn: saveAll at: rect2 origin - bothRects origin.
  992.             "This is the only place differs from the 'moveTo:restore:' 
  993.             method defined in DisplayObject class.  Shan July 22, 1989"
  994.             topF notNil
  995.                 ifTrue: 
  996.                     [topF offset: 0 @ 0.
  997.                     topF displayOn: saveAll at: topFOrg - bothRects origin].
  998.             saveAll displayOn: Display at: bothRects origin]
  999.         ifFalse: 
  1000.             ["If no overlap, do the simple thing (bothrects might be too big)"
  1001.             background displayOn: Display at: location.
  1002.             background fromDisplay: rect2.
  1003.             aForm displayOn: Display at: newLoc].
  1004.     ^background offset: newLoc!
  1005.  
  1006. privateMoveStyle: aBlock 
  1007.     "This method defines the skeleton for moving a mode.  aBlock defines   
  1008.     the style of the move.  Shan May 25, 1989"
  1009.     "This is necessary for a foreign requested move.  Shan June 4, 1989"
  1010.     "Now any button up can terminate the move.  Shan August 3, 1989"
  1011.  
  1012.     | startPt eq |
  1013.     eq _ self eventQueue. "Shan 13 July 1990"
  1014.     startPt _ eq mousePoint.
  1015.     "The startPt can not just use 'event origin' because this move may be 
  1016.     issued by the semantic object of other mode.  The inst var 'event' of 
  1017.     this controller may not have the current cursorPosition.  Shan August 
  1018.     3, 1989"
  1019.     
  1020.     [event _ eq nextWithCursorMoveCompressed.
  1021.     event selector == #cursorMove and: [(startPt - event origin) abs <= (4 @ 4)]] whileTrue.
  1022.     event selector == #cursorMove ifTrue: [^aBlock value: startPt].
  1023.     "self processEvent: event.  Use putBack.  Shan 25 May 1990"
  1024.     eq putBack: event.
  1025.     "This is used by the 'move*FB' msg group only.  Return nil when not 
  1026.     moved. "
  1027.     ^nil! !
  1028.  
  1029. !MController methodsFor: 'sharedBehavior-indicating'!
  1030.  
  1031. deHighlight
  1032.     "ASSUME: The mode understands the message 'deHighlight'  Shan May 
  1033.      29, 1989"
  1034.  
  1035.     mode deHighlight.
  1036.     ^true!
  1037.  
  1038. dragDeHighlight
  1039.     "Shan July 22, 1989"
  1040.  
  1041.     mode highlighted
  1042.         ifTrue: 
  1043.             [event data mode: mode.
  1044.             event data message: #dragDeHighlight].
  1045.     ^true!
  1046.  
  1047. dragDeHighlightOnTop
  1048.     "Shan July 22, 1989"
  1049.  
  1050.     mode highlighted
  1051.         ifTrue: 
  1052.             [event data mode: mode.
  1053.             event data message: #dragDeHighlightOnTop].
  1054.     ^true!
  1055.  
  1056. dragHighlight
  1057.     "Highlight when a mode is dragged on top of me.  Shan July 22, 1989"
  1058.  
  1059.     event data mode: mode.
  1060.     event data message: #dragHighlight.
  1061.     ^true!
  1062.  
  1063. dragHighlightOnTop
  1064.     "Highlight when a mode is dragged on top of me.  I will stay on top  
  1065.     (unboscured) when the cursor is in my area.  Shan July 22, 1989"
  1066.  
  1067.     event data mode: mode.
  1068.     event data message: #dragHighlightOnTop.
  1069.     ^true!
  1070.  
  1071. highlight
  1072.     "ASSUME: The mode understands the message 'highlight'  Shan May 
  1073.     29, 1989"
  1074.  
  1075.     mode highlight.
  1076.     ^true! !
  1077.  
  1078. !MController methodsFor: 'sharedBehavior-link'!
  1079.  
  1080. rubberLineOriginCltn: points within: aRect 
  1081.     "Shan November 21, 1989"
  1082.  
  1083.     ^self
  1084.         rubberLineOriginCltn: points
  1085.         within: aRect
  1086.         releaseSelectors: (OrderedCollection with: #leftButtonDown with: #middleButtonDown)!
  1087.  
  1088. rubberLineOriginCltn: points within: aRect releaseSelectors: releaseSelectors 
  1089.     "Shan March 16, 1990"
  1090.  
  1091.     ^self
  1092.         rubberLineOriginCltn: points
  1093.         within: aRect
  1094.         releaseSelectors: releaseSelectors
  1095.         gridPoint: 1@1!
  1096.  
  1097. rubberLineOriginCltn: points within: aRect releaseSelectors: releaseSelectors gridPoint: gridPoint 
  1098.     "Display a set of rubber lines connecting the cursor and the 
  1099.     collection of points while the user is dragging the cursor. Return the 
  1100.     final cursor position. Shan July 14, 1989"
  1101.     "Add the releaseSelectors cltn as a parameter to define the release 
  1102.     event. Shan November 23, 1989"
  1103.  
  1104.     | endPt clipRect topMode eq |
  1105.     eq _ self eventQueue. "Shan 13 July 1990"
  1106.     clipRect _ aRect.
  1107.     clipRect isNil ifTrue: [clipRect _ Display boundingBox].    "event origin"
  1108.     endPt _ eq mousePoint.
  1109.     ToolGhost
  1110.         starFrom: endPt
  1111.         to: points
  1112.         clip: clipRect.
  1113.     event _ eq next.
  1114.     topMode _ mode topMode.
  1115.     mode beforeDrag: #link.
  1116.     [(releaseSelectors includes: event selector) not]
  1117.         whileTrue: 
  1118.             [event _ eq nextWithCursorMoveCompressed.
  1119.             ToolGhost
  1120.                 starFrom: endPt
  1121.                 to: points
  1122.                 clip: clipRect.
  1123.             event data: (DragData mode: mode offset: nil).
  1124.             topMode processEvent: event.
  1125.             "Grid the feedback. Shan March 15, 1990"
  1126.             endPt _ event origin grid: gridPoint.
  1127.             ToolGhost
  1128.                 starFrom: endPt
  1129.                 to: points
  1130.                 clip: clipRect].
  1131.     ToolGhost
  1132.         starFrom: endPt
  1133.         to: points
  1134.         clip: clipRect.
  1135.     mode afterDrag: #link.
  1136.     ^endPt"Shan March 16, 1990 event origin"! !
  1137.  
  1138. !MController methodsFor: 'sharedBehavior-menu'!
  1139.  
  1140. expandLeftMenu
  1141.     "Shan October 21, 1989"
  1142.  
  1143.     ^self expandMenu: semObj leftButtonMenu.!
  1144.  
  1145. expandMenu: menu 
  1146.     "Shan October 21, 1989"
  1147.     "Activate the left button menu. Shan May 25, 1989"
  1148.     "ASSUME: 1. semObj understands the message leftButtonMenu and 
  1149.     returns an Action menu."
  1150.  
  1151.     | index |
  1152.     (menu isKindOf: PopUpMenu)
  1153.         ifTrue: 
  1154.             [self eventQueue disable.
  1155.             index _ menu startUp.
  1156.             self eventQueue enable.
  1157.             index ~= 0 ifTrue: [semObj perform: (menu selectorAt: index)
  1158.                     "with: event  Shan October 21, 1989"]]
  1159.         ifFalse: ["The menu is a MMS menu. Shan July 30, 1989"
  1160.             menu startUpOnSemanticObject: semObj].
  1161.     ^true!
  1162.  
  1163. expandMiddleMenu
  1164.     "Shan October 21, 1989"
  1165.  
  1166.     ^self expandMenu: semObj middleButtonMenu.!
  1167.  
  1168. expandRightMenu
  1169.     "Shan October 21, 1989"
  1170.  
  1171.     ^self expandMenu: semObj rightButtonMenu.! !
  1172.  
  1173. !MController methodsFor: 'Interrupt handling'!
  1174.  
  1175. processInterrupt
  1176.     "Shan November 18, 1989"
  1177.  
  1178.     mode edit!
  1179.  
  1180. shouldProcessInterrupt
  1181.     "This is the key to control the Ctrl-E mechanism. If this method 
  1182.     always returns false, the mechanism is switched off. This is useful 
  1183.     when the interface is being productized. If true is always returned, 
  1184.     the user can do multiple Ctrl-E's and get to see the implentation of 
  1185.     how the modes for the interrupt mechanism is implemented. This is 
  1186.     dangerous and is only useful for MoDE kernel designer and 
  1187.     maintainer. The default behavior implemented here is to allow only 
  1188.     one Ctrl-E. This allows the user to investigate his own interface 
  1189.     and from there, go to his application without getting into a strange 
  1190.     state to him where he is viewing the implementation of the Ctrl-E 
  1191.     handling mechanism. November 18, 1989"
  1192.  
  1193.     ^(mode topMode lastSubMode semanticObject isMemberOf: ModeEditBackground) not! !
  1194.  
  1195. !MController methodsFor: 'copying'!
  1196.  
  1197. deepCopy
  1198.     "Check self against the OccurrenceDictionary.  This method is 
  1199.     overriden in the Mode, MMSController1, SemanticObject and DispObj 
  1200.     class.  Shan  August 3, 1989"
  1201.  
  1202.     | newObject class index exist |
  1203.     exist _ true.
  1204.     newObject _ OccurrenceDictionary at: self ifAbsent: [exist _ false].
  1205.     exist ifFalse: 
  1206.             [class _ self class.
  1207.             class == Object ifTrue: [^self].
  1208.             class isVariable
  1209.                 ifTrue: 
  1210.                     [index _ self basicSize.
  1211.                     newObject _ class basicNew: index.
  1212.                     OccurrenceDictionary at: self put: newObject.
  1213.                     [index > 0]
  1214.                         whileTrue: 
  1215.                             [newObject basicAt: index put: (self basicAt: index) deepCopy.
  1216.                             index _ index - 1]]
  1217.                 ifFalse: 
  1218.                     [newObject _ class basicNew.
  1219.                     OccurrenceDictionary at: self put: newObject].
  1220.             index _ class instSize.
  1221.             [index > 0]
  1222.                 whileTrue: 
  1223.                     [newObject instVarAt: index put: (self instVarAt: index) deepCopy.
  1224.                     index _ index - 1]].
  1225.     ^newObject! !
  1226.  
  1227. !MController methodsFor: 'tracking/replay'!
  1228.  
  1229. eventQueue
  1230.     "Shan 13 July 1990"
  1231.  
  1232.     ^mode eventQueue! !
  1233. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  1234.  
  1235. MController class
  1236.     instanceVariableNames: ''!
  1237.  
  1238.  
  1239. !MController class methodsFor: 'instance creation'!
  1240.  
  1241. new
  1242.     ^super new initialize!
  1243.  
  1244. view: aView
  1245.     ^self new view: aView! !
  1246.  
  1247. !MController class methodsFor: 'access'!
  1248.  
  1249. eventResponsesDict
  1250.     "Every class has one dictionary to record the events and their  
  1251.     responses that are shared by all the instances of that class.  The  
  1252.     naming convention is <className>ERD.  This dictionary should be 
  1253.     initialized in the class initialize method. Shan May 24, 1989"
  1254.  
  1255.     ^MMSController1ERD! !
  1256.  
  1257. !MController class methodsFor: 'initialize'!
  1258.  
  1259. ERDinit
  1260.     "MMSController1 initialize"
  1261.  
  1262.     MMSController1ERD _ Dictionary new.!
  1263.  
  1264. initAllERDict
  1265.     "This is called by the Booter and the RootMode when starting an 
  1266.     application.  Shan June 2, 1989"
  1267.  
  1268.     self ERDinit.
  1269.     self allSubclasses do: [:each | each ERDinit]! !
  1270.  
  1271. MController subclass: #OpaqueController1
  1272.     instanceVariableNames: ''
  1273.     classVariableNames: ''
  1274.     poolDictionaries: ''
  1275.     category: 'TestMVC-Shan'!
  1276.  
  1277.  
  1278. !OpaqueController1 methodsFor: 'event handling'!
  1279.  
  1280. defaultReturnValue
  1281.     "This value distinguishes MMSController1 from OpaqueController1.  
  1282.     Shan June 13, 1989"
  1283.  
  1284.     ^true! !
  1285.  
  1286. Object subclass: #DragData
  1287.     instanceVariableNames: 'mode offset message '
  1288.     classVariableNames: ''
  1289.     poolDictionaries: ''
  1290.     category: 'TestMVC-Shan'!
  1291. DragData comment:
  1292. 'This is used in the communication between the dragged mode and the entered mode.  Shan July 22, 1989'!
  1293.  
  1294.  
  1295. !DragData methodsFor: 'access'!
  1296.  
  1297. message
  1298.     ^message!
  1299.  
  1300. message: m
  1301.     message _ m!
  1302.  
  1303. mode
  1304.     ^mode!
  1305.  
  1306. mode: m 
  1307.     mode _ m!
  1308.  
  1309. offset
  1310.     ^offset!
  1311.  
  1312. offset: p
  1313.     offset _ p! !
  1314.  
  1315. !DragData methodsFor: 'private'!
  1316.  
  1317. mode: m offset: p
  1318.     mode _ m.
  1319.     offset _ p! !
  1320. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  1321.  
  1322. DragData class
  1323.     instanceVariableNames: ''!
  1324.  
  1325.  
  1326. !DragData class methodsFor: 'instance creation'!
  1327.  
  1328. mode: m offset: p 
  1329.     "Shan July 22, 1989"
  1330.  
  1331.     ^self new mode: m offset: p! !